package chapter67;

import java.util.Scanner;

public class TestPet {
	public static void main(String[] args) {
		System.out.println("欢迎您来到宠物店！");
		Dog dog1 = new Dog();
		dog1.setName("多多");
		dog1.setHealth(-1000);
		dog1.setLove(40);
		dog1.setStrain("聪明的拉布拉多犬");

		dog1.showInfo();
		
		Scanner input = new Scanner(System.in);
		Penguin penguin = new Penguin();
		System.out.println("请输入宠物的名字：");
		String name = input.next();
		penguin.setName(name);
		System.out.println("请选择要领养的宠物类型：(1、狗狗 2、企鹅)");
		int strain = input.nextInt();
		penguin.setStrain(strain);
		System.out.println("请选择企鹅的性别：(1、Q仔 2、Q妹)");
		int sex = input.nextInt();
		penguin.setSex(sex);
		System.out.println("请输入企鹅的健康值(0~100之间)：");
		int health = input.nextInt();
		penguin.setHealth(health);
		System.out.println("请输入主人与企鹅的亲密度(0~100之间):");
		int love = input.nextInt();
		penguin.setLove(love);
		
		penguin.showInfo();
		System.out.println("\n\n");
		
		Pet pet = new Dog("多多","吉娃娃");
		pet.setHealth(30);
		Master master = new Master();
		master.cure(pet);
		System.out.println("*****************狗狗看病后*********************");
		pet.showInfo();
		System.out.println("\n\n");
		
		master.feed(pet);
		System.out.println("*****************狗狗喂食后*********************");
		pet.showInfo();
		System.out.println("\n\n");
		
		Dog dog = (Dog)pet;
		dog.catchFlyingDisk();
		
		Pet pets = new Penguin("妞妞","Q妹");
		pets.setHealth(44);
		master.cure(pets);
		System.out.println("*****************企鹅看病后*********************");
		pets.showInfo();
		System.out.println("\n\n");
		
		master.feed(pet);
		System.out.println("*****************企鹅喂食后*********************");
		pet.showInfo();
		
		Penguin png = (Penguin) pets;
		png.swim();
		System.out.println("\n\n");
		
		Pet pet1 = new Dog("多多","吉娃娃");
		//Pet pet1 = new Penguin("妞妞","Q妹");
		if (pet1 instanceof Dog){
			Dog dogs = (Dog)pet1;
			dogs.catchFlyingDisk();
		}else if(pet1 instanceof Penguin){
			Penguin pngs = (Penguin)pet1;
			pngs.swim();
		}
	}
}
